from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator


class StudentSurvey(models.Model):
    id = models.AutoField(primary_key=True)
    # 基本信息
    gradyear = models.IntegerField(verbose_name='毕业年份', validators=[MinValueValidator(1900), MaxValueValidator(2100)])
    gender = models.CharField(verbose_name='性别', max_length=10, choices=[('M', '男'), ('F', '女'), ('O', '其他')])
    age = models.FloatField(verbose_name='年龄', validators=[MinValueValidator(0), MaxValueValidator(120)])
    friends = models.IntegerField(verbose_name='朋友数量', validators=[MinValueValidator(0)])

    # 运动兴趣 (0-5评分)
    basketball = models.IntegerField(verbose_name='篮球兴趣', validators=[
                                     MinValueValidator(0), MaxValueValidator(5)], default=0)
    football = models.IntegerField(verbose_name='足球兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    soccer = models.IntegerField(verbose_name='英式足球兴趣', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)
    softball = models.IntegerField(verbose_name='垒球兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    volleyball = models.IntegerField(verbose_name='排球兴趣', validators=[
                                     MinValueValidator(0), MaxValueValidator(5)], default=0)
    swimming = models.IntegerField(verbose_name='游泳兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    cheerleading = models.IntegerField(verbose_name='啦啦队兴趣', validators=[
                                       MinValueValidator(0), MaxValueValidator(5)], default=0)
    baseball = models.IntegerField(verbose_name='棒球兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    tennis = models.IntegerField(verbose_name='网球兴趣', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)
    sports = models.IntegerField(verbose_name='运动总体兴趣', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 艺术和音乐兴趣
    dance = models.IntegerField(verbose_name='舞蹈兴趣', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    band = models.IntegerField(verbose_name='乐队兴趣', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    marching = models.IntegerField(verbose_name='军乐队兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    music = models.IntegerField(verbose_name='音乐兴趣', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    rock = models.IntegerField(verbose_name='摇滚音乐兴趣', validators=[
                               MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 宗教相关
    god = models.IntegerField(verbose_name='信仰程度', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    church = models.IntegerField(verbose_name='教堂活动参与度', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)
    jesus = models.IntegerField(verbose_name='宗教信仰强度', validators=[
                                MinValueValidator(0), MaxValueValidator(5)], default=0)
    bible = models.IntegerField(verbose_name='圣经阅读频率', validators=[
                                MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 外表和时尚兴趣
    hair = models.IntegerField(verbose_name='发型关注度', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    dress = models.IntegerField(verbose_name='着装关注度', validators=[
                                MinValueValidator(0), MaxValueValidator(5)], default=0)
    blonde = models.IntegerField(verbose_name='金发偏好', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)
    mall = models.IntegerField(verbose_name='逛商场频率', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    shopping = models.IntegerField(verbose_name='购物兴趣', validators=[
                                   MinValueValidator(0), MaxValueValidator(5)], default=0)
    clothes = models.IntegerField(verbose_name='服装关注度', validators=[
                                  MinValueValidator(0), MaxValueValidator(5)], default=0)
    hollister = models.IntegerField(verbose_name='Hollister品牌偏好', validators=[
                                    MinValueValidator(0), MaxValueValidator(5)], default=0)
    abercrombie = models.IntegerField(verbose_name='Abercrombie品牌偏好', validators=[
                                      MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 个性特征评分
    cute = models.IntegerField(verbose_name='可爱特质', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    sexy = models.IntegerField(verbose_name='性感特质', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    hot = models.IntegerField(verbose_name='魅力特质', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    kissed = models.IntegerField(verbose_name='亲密关系经验', validators=[
                                 MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 风险行为评分
    drunk = models.IntegerField(verbose_name='饮酒频率', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)
    drugs = models.IntegerField(verbose_name='药物使用频率', validators=[
                                MinValueValidator(0), MaxValueValidator(5)], default=0)
    death = models.IntegerField(verbose_name='死亡话题关注度', validators=[
                                MinValueValidator(0), MaxValueValidator(5)], default=0)
    die = models.IntegerField(verbose_name='生死观念强度', validators=[MinValueValidator(0), MaxValueValidator(5)], default=0)

    # 时间戳
    created_at = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    updated_at = models.DateTimeField(verbose_name='更新时间', auto_now=True)

    class Meta:
        verbose_name = '用户调查'
        verbose_name_plural = '用户调查'

    def __str__(self):
        return f"用户调查 #{self.id} - {self.created_at.strftime('%Y-%m-%d')}"
